{include file="layout/header" title="客服设置" /}
<div class="view-body">
    {include file="layout/menu" /}
    <div class="view-product">
        <div class="company_identify">
            <div class="manage-head">
                <h6 class="padding-left manage-head-con">
                    轮播图设置
                </h6>
            </div>
            <div class="layui-lr-20 margin-top-25 clearfix">
                <form action="{:url('admin/Config/save',['key'=>'banner'])}" class="layui-form" id="bannerForm" method="post">
                    <div class="layui-form-item margin-left-300 service-tpl">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">图片路径</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="0[src]" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input class="layui-upload-file" lay-title="上传图片" lay-type="images" index="0" name="image" type="file">
                                    </input>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">跳转地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="0[link]" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">图片路径</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="1[src]" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input class="layui-upload-file" lay-title="上传图片" lay-type="images" index="1" name="image" type="file">
                                    </input>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">跳转地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="1[link]" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">图片路径</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="2[src]" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input class="layui-upload-file" lay-title="上传图片" lay-type="images" index="2" name="image" type="file">
                                    </input>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">跳转地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="2[link]" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">图片路径</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="3[src]" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input class="layui-upload-file" lay-title="上传图片" lay-type="images" index="3" name="image" type="file">
                                    </input>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">跳转地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="3[link]" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">图片路径</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="4[src]" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input class="layui-upload-file" lay-title="上传图片" lay-type="images" index="4" name="image" type="file">
                                    </input>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">跳转地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="4[link]" class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <button class="layui-btn layui-btn-normal" lay-submit>确定</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var formObj = new Form('bannerForm');
    formObj.init({$banner});

    layui.use(['form','upload','layer'], function(){

        var layer = layui.layer;
        var $ = layui.jquery;
        
        var uploadIndex = 0;
        layui.upload({
            url: "{:url('admin/upload/image')}",
            method: 'post',
            before: function(input){
                uploadIndex = $(input).attr('index');
            },
            success: function(res){
                if(res.status == 1){
                    if(uploadIndex){
                        uploadIndex = uploadIndex + '\[src\]';
                        $('input[name="'+uploadIndex+'"]').val('/uploads/images/'+ res.src);
                    }
                    layer.msg(res.msg);
                }else {
                    layer.msg('上传失败！');
                }
            }
        });
    });
</script>
{include file="layout/footer" /}
